# -- coding: utf-8 --
import time

def get_time(test1):
    start_time = time.time()
    test1()
    end_time = time.time()
    print(f'消耗的时间是{end_time-start_time}')


def decorator(name):
    def outer(func):  # 传递被修饰的函数对象
        def inner(*args, **kwargs):   # 增强被修饰的函数的功能
            print(f'要计算{name}方法执行的时间')
            start_time = time.time()
            result = func(*args, **kwargs)  # 执行被修饰的函数
            end_time = time.time()
            print(f'消耗的时间是{end_time-start_time}')
            return result
        return inner
    return outer

@decorator('demo10')
def test1():

    print('test1开始')
    time.sleep(3)
    print('test1结束')

def test2(a, b, c):
    print('test2开始')
    time.sleep(5)
    print('test2结束')
    print(f'三个数的和是{a+b+c}')


if __name__ == '__main__':

    test1()

